package underly

import (
	"awesomeProject1/modules"
)

func GetCompanyList() (error, []modules.Company) {
	var p []modules.Company

	err := db.Table("huodai_company").Order("id ASC").Find(&p).Error

	return err, p
}

func UpCompany(p modules.Company) error {
	err := db.Table("huodai_company").Where("id = ?", p.Id).Updates(&p).Error
	return err
}
func DelCompany(id string) error {

	err := db.Table("huodai_company").Where("id = ?", id).Delete(modules.Company{}).Error
	return err
}

func AddCompany(p modules.Company) error {
	err := db.Table("huodai_company").Create(&p).Error
	return err
}
